<?php
/**
 * Created by PhpStorm.
 * User: zilongs
 * Date: 17-11-17
 * Time: 上午12:13
 */
namespace app\model;
use think\Config;

class Order extends Base
{
    //设置数据表(不含前缀)
    protected $name = 'orders';

    protected $dateFormat = 'Y-m-d H:i:s';

    public function getCustomerServiceAttr($value,$data){
        return getCustomerService($data['admin_id']);
    }

    public function getStatusTextAttr($value,$data){
        $status = Config::get('website.order_status');
        return $status[$data['status']];
    }

    public function getItemAttr($value,$data){
        $item = Items::get(['id'=>$data['item_id']]);
        return $item;
    }

    public function getUserAttr($value,$data){
        $user = Users::get(['id'=>$data['user_id']]);
        return $user;
    }
}